Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid clearing timeouts #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

avoid clearing timeouts #1

wants to merge 2 commits into from

Conversation

dominictarr
Copy link
Owner

If a timeout has been recently set, avoid clearing it. clearing timeouts is actually significant!
also added test/bench.js clearing half a million timeouts takes 2 seconds.

the new approach (which still passes all the tests) checks if an already set timeout was within half the delay time. if so, skips clearing and setting a timeout.

on flumeview-hashtable this is measurable on the benchmark - (note: it only affects append) and other things such as the log implementation and codec have a strong effect, too. but it's still noticable through that.

@dominictarr
Copy link
Owner Author

oops, ment to mention @arj

@arj03
Copy link

arj03 commented Dec 5, 2018

Benchmarks on my machine:

closure 3862
proto 236
clear 4267
double 22

@dominictarr
Copy link
Owner Author

I said "pretty sure I remember setTimout is slow" in flumedb/flumeview-reduce#12 then I saw this PR from a year ago...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants